T
The type of the EntityManager
Cocktail Help Reference
DesignTimeViewModelLocatorBase<T> Class
Members  See Also  Send Feedback
Cocktail Assembly > Cocktail Namespace : DesignTimeViewModelLocatorBase<T> Class



Glossary Item Box

Base class for a design time ViewModelLocator.

Object Model

DesignTimeViewModelLocatorBase<T> Class

Syntax

Visual Basic (Declaration) 
Public MustInherit Class DesignTimeViewModelLocatorBase(Of T As IdeaBlade.EntityModel.EntityManager) 
Visual Basic (Usage)Copy Code
Dim instance As DesignTimeViewModelLocatorBase(Of T)
C# 
public abstract class DesignTimeViewModelLocatorBase<T> 
where T: IdeaBlade.EntityModel.EntityManager
C++/CLI 
generic<typename T>
public ref class DesignTimeViewModelLocatorBase abstract 
where T: IdeaBlade.EntityModel.EntityManager

Type Parameters

T
The type of the EntityManager

Remarks

To implement a concrete ViewModelLocator for your project, extend from this class and override the CreateEntityManager() method. Return an instance of type subclass of DesignTimeEntityManagerProviderBase. Add references to all the view models in the module or application and by adding the following lines of code for each ViewModel. Implement a Start() method to initialize the ViewModel.
            public CustomerListViewModel CustomerListViewModel
            {
                get
                {
                    return new CustomerListViewModel().Start();
                }
            }
            

In Silverlight and WPF, place the ViewModelLocator in the App.xaml resources:

            <Application.Resources>
                <designTime:ViewModelLocator xmlns:designTime="clr-namespace:your-namespace"
                                             x:Key="ViewModeLocator" />
            </Application.Resources>
            

Then use:

            d:DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModelName}"
            

Inheritance Hierarchy

System.Object
   Cocktail.DesignTimeViewModelLocatorBase<T>

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.